# -*- coding: utf-8  -*-
#!/usr/local/bin/python

__author__ = 'yaojian'

from misc.configbase import ConfigBase
from misc.cache import Cache
from cm.appserver.backend import AppServerManager


class AppServerConf(ConfigBase):

    @classmethod
    def all_data(cls):
        _cache_key = "ALL_APP_Server_Conf_DICT"
        _cache = Cache(backend = "systemconfig")
        _conf_list = _cache.get(_cache_key) or []
        if not _conf_list:
            _manager = AppServerManager()
            _conf_list = _manager.query_config_dict()
            _cache.set(key = _cache_key, value = _conf_list)
        cls.DICT = _conf_list
        return _conf_list



